﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xinkui.WebModel.BasicControl;
using Xinkui.DataAccess.AutoGenerator;
using Xinkui.Common;
using Xinkui.WebModel.Cache;
using Xinkui.WebModel;

public partial class UserControl_fore_UC_Home_CatalogProduct : ForeControl {

    public int BindCategoryID { get; set; }

    public int Floor { get; set; }

    public string BindCategoryName { get; set; }
    public string BindCategoryLink { get; set; }
    protected void Page_Load(object sender, EventArgs e) {

        var categoryInfo = CategoryCache.ListAllCategory().FirstOrDefault(u => u.CategoryInfo.CategoryID == BindCategoryID);
        if (categoryInfo != null) {
            BindCategoryLink = URLHelper.LinkToCatalogProducts(categoryInfo.PathIds);
            BindCategoryName = categoryInfo.CategoryInfo.Title;
        }

        this.rptProductSource.DataSource = Singleton<ProductInfoDataAccess>.Instance.ListHomeRecommendProducts(5, BindCategoryID);
        this.rptProductSource.DataBind();
    }
}